package com.sgb.kjwl.view.ui.adapter.material;

import android.content.Context;
import android.widget.TextView;

import com.blankj.utilcode.util.SpanUtils;
import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.AlbumEntity;
import com.sgb.kjwl.model.entity.CallPhoneEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class CallPhoneAdapter extends BaseRecycleAdapter<CallPhoneEntity> {

    private TextView tvNetAlbum;

    public CallPhoneAdapter(Context context, List<CallPhoneEntity> datas) {
        super(context, R.layout.item_call_phone, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, CallPhoneEntity entity) {
        tvNetAlbum = holder.itemView.findViewById(R.id.tv_net_album);
        if ("0".equals(entity.getType())) {
            tvNetAlbum.setText("呼叫 " + entity.getPhone());
        } else {
            SpanUtils.with(tvNetAlbum).appendImage(R.mipmap.im_jiaoliu).append("  ").append(entity.getPrincipalName()).create();
        }
    }
}
